package com.cs.bd.ad.self;

import android.annotation.TargetApi;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Administrator on 2017/9/1.
 */

public class ClickHelper {

    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
    public static boolean performClick(ViewGroup view) {
        for (int i = 0; i < view.getChildCount(); i++) {
            View tmp = view.getChildAt(i);
            if (tmp.hasOnClickListeners()) {
                tmp.performClick();
                return true;
            }
            if (ViewGroup.class.isInstance(tmp)) {
                performClick((ViewGroup) tmp);
            }
        }
        return false;
    }

}
